package com.xc.stock.domain.basic.entity;

import com.xc.stock.constant.RoleEnum;
import com.xc.stock.dto.model.DestInfo;
import com.xc.stock.dto.model.TradeAccThumb;
import com.xc.stock.infrastructure.db.po.TradeAccPO;
import com.xc.stock.utils.Beans;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * TradeAcc
 *
 * @author rplees
 * @email rplees.i.ly@gmail.com
 * @created 2022/08/12
 */
@Data
@NoArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = false)
public class TradeAcc extends TradeAccPO {
	public TradeAccThumb thumb() {
		TradeAccThumb thumb = new TradeAccThumb();
		Beans.copyPropertiesIgnoreNull(this, thumb);
		return thumb;
	}
	
	public DestInfo destInfo() {
		/**
		 * .destId(dest.idInt())
				.role(dest.getRe().code())
				.destName(dest.getName())
				.destPhone(dest.getPhone())
		 */
		
		return DestInfo.builder()
				.id(String.valueOf(getDestId()))
				.name(getDestName())
				.phone(getDestPhone())
				.re(RoleEnum.of(getRole()))
				.build();
	}
}
